﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MCSFramework.IFStrategy;

namespace MCSFramework.Model.CM
{
    /// <summary>
    /// CM_Client数据实体类
    /// </summary>
    [Serializable]
    public class CM_Client : IModel
    {
        #region 私有变量定义
        private int _id = 0;
        private string _code = string.Empty;
        private string _fullname = string.Empty;
        private string _shortname = string.Empty;
        private int _organizecity = 0;
        private int _officalcity = 0;
        private string _address = string.Empty;
        private string _telenum = string.Empty;
        private string _fax = string.Empty;
        private string _email = string.Empty;
        private string _url = string.Empty;
        private string _postcode = string.Empty;
        private int _chieflinkman = 0;
        private int _activeflag = 0;
        private DateTime _opentime = DateTime.Now;
        private DateTime _closetime = DateTime.Now;
        private int _clienttype = 0;
        private int _supplier = 0;
        private int _clientmanager = 0;
        private int _approveflag = 0;
        private DateTime _inserttime = DateTime.Now;
        private int _insertstaff = 0;
        private DateTime _updatetime = DateTime.Now;
        private int _updatestaff = 0;
        private string _extpropertys = string.Empty;


        #endregion

        #region 构造函数
        public CM_Client()
        {
        }

        public CM_Client(int id, string code, string name, string fullname, string shortname, int organizecity, int officalcity, string address,
            string telenum, string fax, string email, string url, string postcode, int clientlinkman, int activeflag, DateTime opentime,
            DateTime closetime, int clienttype, int supplier, int clientmanager, int approveflag, DateTime inserttime, int insertstaff, DateTime updatetime,
            int updatestaff, string exepropertys)
        {
            _id = id;
            _code = code;
            _fullname = fullname;
            _shortname = shortname;
            _organizecity = organizecity;
            _officalcity = officalcity;
            _address = address;
            _telenum = telenum;
            _fax = fax;
            _email = email;
            _url = url;
            _postcode = postcode;
            _chieflinkman = clientlinkman;
            _activeflag = activeflag;
            _opentime = opentime;
            _closetime = closetime;
            _clienttype = clienttype;
            _supplier = supplier;
            _clientmanager = clientmanager;
            _approveflag = approveflag;
            _inserttime = inserttime;
            _insertstaff = insertstaff;
            _updatetime = updatetime;
            _updatestaff = updatestaff;
            _extpropertys = exepropertys;
        }
        #endregion

        #region 公共属性

        public int ID
        {
            get { return _id; }
            set { _id = value; }
        }
        public string Code
        {
            get { return _code; }
            set { _code = value; }
        }
        public string FullName
        {
            get { return _fullname; }
            set { _fullname = value; }
        }
        public string ShortName
        {
            get { return _shortname; }
            set { _shortname = value; }
        }
        public int OrganizeCity
        {
            get { return _organizecity; }
            set { _organizecity = value; }
        }
        public int OfficalCity
        {
            get { return _officalcity; }
            set { _officalcity = value; }
        }
        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }
        public string TeleNum
        {
            get { return _telenum; }
            set { _telenum = value; }
        }
        public string Fax
        {
            get { return _fax; }
            set { _fax = value; }
        }
        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }
        public string Url
        {
            get { return _url; }
            set { _url = value; }
        }
        public string PostCode
        {
            get { return _postcode; }
            set { _postcode = value; }
        }
        public int ChiefLinkMan
        {
            get { return _chieflinkman; }
            set { _chieflinkman = value; }
        }
        public int ActiveFlag
        {
            get { return _activeflag; }
            set { _activeflag = value; }
        }
        public DateTime OpenTime
        {
            get { return _opentime; }
            set { _opentime = value; }
        }
        public DateTime CloseTime
        {
            get { return _closetime; }
            set { _closetime = value; }
        }

        public int ClientType
        {
            get { return _clienttype; }
            set { _clienttype = value; }
        }
        public int Supplier
        {
            get { return _supplier; }
            set { _supplier = value; }
        }
        public int ClientManager
        {
            get { return _clientmanager; }
            set { _clientmanager = value; }
        }
        public int ApproveFlag
        {
            get { return _approveflag; }
            set { _approveflag = value; }
        }
        public DateTime InsertTime
        {
            get { return _inserttime; }
            set { _inserttime = value; }
        }
        public int InsertStaff
        {
            get { return _insertstaff; }
            set { _insertstaff = value; }
        }
        public DateTime UpdateTime
        {
            get { return _updatetime; }
            set { _updatetime = value; }
        }
        public int UpdateStaff
        {
            get { return _updatestaff; }
            set { _updatestaff = value; }
        }
        public string ExtPropertys
        {
            get { return _extpropertys; }
            set { _extpropertys = value; }
        }
        #endregion

        #region IModel 成员

        public string ModelName
        {
            get { return "CM_Client"; }
        }

        /// <summary>
        /// 索引访问器
        /// </summary>
        /// <param name="FiledName"></param>
        /// <returns></returns>
        public string this[string FiledName]
        {
            get
            {
                switch (FiledName)
                {
                    case "ID": return _id.ToString();
                    case "Code": return _code;
                    case "FullName": return _fullname;
                    case "ShortName": return _shortname.ToString();
                    case "OrganizeCity": return _organizecity.ToString();
                    case "OfficalCity": return _officalcity.ToString();
                    case "Address": return _address.ToString();
                    case "TeleNum": return _telenum.ToString();
                    case "Fax": return _fax.ToString();
                    case "Email": return _email.ToString();
                    case "Url": return _url.ToString();
                    case "Postcode": return _postcode.ToString();
                    case "ClientLinkMan": return _chieflinkman.ToString();
                    case "ActiveFlag": return _activeflag.ToString();
                    case "OpenTime": return _opentime.ToString("yyyy-MM-dd");
                    case "CloseTime": return _closetime.ToString("yyyy-MM-dd");
                    case "ClientType": return _clienttype.ToString();
                    case "Supplier": return _supplier.ToString();
                    case "ClientManager": return _clientmanager.ToString();
                    case "ApproveFlag": return _approveflag.ToString();
                    case "InsertTime": return _inserttime.ToString();
                    case "InsertStaff": return _insertstaff.ToString();
                    case "UpdateTime": return _updatetime.ToString();
                    case "UpdateStaff": return _updatestaff.ToString();
                    case "ExePropertys": return _extpropertys.ToString();
                    default: return "";
                }
            }
            set
            {
                switch (FiledName)
                {
                    case "ID": int.TryParse(value, out _id); break;
                    case "Code": _code = value; break;
                    case "FullName": _fullname = value; break;
                    case "ShortName": _shortname = value; break;
                    case "OrganizeCity": int.TryParse(value, out _organizecity); break;
                    case "OfficalCity": int.TryParse(value, out _officalcity); break;
                    case "Address": _address = value; break;
                    case "TeleNum": _telenum = value; break;
                    case "Fax": _fax = value; break;
                    case "Email": _email = value; break;
                    case "Url": _url = value; break;
                    case "Postcode": _postcode = value; break;
                    case "ClientLinkMan": int.TryParse(value, out _chieflinkman); break;
                    case "ActiveFlag": int.TryParse(value, out _activeflag); break;
                    case "OpenTime": DateTime.TryParse(value, out _opentime); break;
                    case "CloseTime": DateTime.TryParse(value, out _closetime); break;
                    case "ClientType": int.TryParse(value, out _clienttype); break;
                    case "Supplier": int.TryParse(value, out _supplier); break;
                    case "ClientManager": int.TryParse(value, out _clientmanager); break;
                    case "ApproveFlag": int.TryParse(value, out _approveflag); break;
                    case "InsertTime": DateTime.TryParse(value, out _inserttime); break;
                    case "InsertStaff": int.TryParse(value, out _insertstaff); break;
                    case "UpdateTime": DateTime.TryParse(value, out _updatetime); break;
                    case "UpdateStaff": int.TryParse(value, out _updatestaff); break;
                    case "ExePropertys": _extpropertys = value; break;
                }
            }
        }

        #endregion
    }
}
